//
//  H5PublicViewController.m
//  Logistics
//
//  Created by 华谕 on 2017/10/31.
//  Copyright © 2017年 HUYU. All rights reserved.
//

#import "H5PublicViewController.h"

@interface H5PublicViewController ()<UIWebViewDelegate>
@property (nonatomic, strong)UIWebView *webView;

@end

@implementation H5PublicViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatUI];
}

- (void)creatUI
{
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.translucent = NO;
    self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-STA_NAV_HEIGHT)];
    _webView.delegate = self;
    NSString *str = _url;
    if (![_url containsString:@"http://"])
    {
        str = string(@"http://", _url);
    }
    NSURL *urlStr = [NSURL URLWithString:str];
    NSURLRequest *request = [NSURLRequest requestWithURL:urlStr];
    [_webView loadRequest:request];
    [self.view addSubview:_webView];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
    
    UIWebView *web = webView;
    NSString *htmlTitle = @"document.title";
    NSString *titleHtmlInfo = [web stringByEvaluatingJavaScriptFromString:htmlTitle];
    self.navigationItem.title = titleHtmlInfo;
    
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
